# 导入APIRouter

from fastapi import APIRouter

from app.models.Item import Item

# 实例化APIRouter实例
app = APIRouter(tags=["默认路由"])


# 注册具体方法
@app.get("/")
async def index():
    """
    默认访问链接
    """
    return {
        "code": 200,
        "msg": "你好china"
    }


@app.get('/my')
def my():  # put application's code here
    return '这里是李逵和武松'


@app.put("/items/{item_id}")
def update_item(item_id: int, item: Item):
    return {"item_name": item.name, "item_id": item_id}
